<?php
/***
* @version $Id: index.php 336 2007-01-23 08:12:56Z flexiondotorg $
* @copyright (c) 2006 - 2007 Flexion.Org
*            (c) 2004 - 2005 Project Minerva
*            (c) 2001 - 2006 phpBB Group
* @license   http://opensource.org/licenses/gpl-license.php GNU Public License
***/

define('IN_R3BORN', true);
$root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'),	1);
include($root_path . 'common.' . $phpEx);

//If we found the requested module name then use it.
if ($mvValidModuleName)
{
	$mvModuleName = $mvValidModuleName;
}
//Else use the default module, if no module name was requested
elseif ($mvReqModuleName == '' && $mvDefaultModuleName != '' )
{
	$mvModuleName = $mvDefaultModuleName;
}
//Else we didn't find any useable module
else
{
	$mvModuleName = '';
}

//If we have a module, run it.
if ($mvModuleName != '' && $mvModules[$mvModuleName]['type'] == ADDON_MODULE)
{
	$mvModuleFile = get_var('file', $mvModuleName);

	//First make sure this is a valid file request
	if ($mvModuleFile == 'mvConstants' || $mvModuleFile == 'mvHeaders' || $mvModuleFile == 'mvVersion')
	{
		//We were sent an deliberately invalid filename, someone is up to no good!
		die('Hacking attempt');
	}

	$mvModule_root_path = $root_path . 'modules/' . $mvModuleName . '/';
	$mvModuleTemplates = $mvModules[$mvModuleName]['templates'];

	//Does the requested module file exists? If not try index.php
	if (!@file_exists($mvModule_root_path . $mvModuleFile . '.' . $phpEx))
	{
		$mvModuleFile =	'index';
	}

    // If the requested modile file exists then include it and exit.
	if (@file_exists($mvModule_root_path . $mvModuleFile . '.' . $phpEx))
	{
		include($mvModule_root_path . $mvModuleFile . '.' . $phpEx);
		exit;
	}
	else
	{
		// Could not find the requested module and file.
		$mvModuleTemplates = array();
		$mvModuleName =	'';
		$mvModuleFile =	'';
		$mvModule_root_path = '';
	}
}
else
{
	// Could not find the requested module.
	$mvModuleTemplates = array();
	$mvModuleName =	'';
	$mvModuleFile =	'';
	$mvModule_root_path = '';
}

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

page_header($lang['Site_index']);

//
// The requested module wasn't found, dump out an error.
//
message_die(GENERAL_MESSAGE, $lang['No_module_defined']);

?>